<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

	<title>Form Test</title>
	
	<link rel="stylesheet" href="screen.css" type="text/css" />
	<style type="text/css">
	  #body {
	    width: 600px;
	    margin: 25px auto;
	  }
	</style>
</head>

<body>

<div id="body">
<h1>Form test</h1>

<p>Test page for the Formtastic form processing library.</p>

<?php
error_reporting(E_ALL);

require('formtastic.php');

$form = new Form();


$form->addField(FieldFactory::TextField()->name("name")->label("Name")->required(true)->description("Lorem ipsum dolor sit amet."));

$form->addField(FieldFactory::TextAreaField()->name("body")->label("Body")->required(true)->description("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."));

$values["a"] = Array("label" => "Something",
                     "description" => "Lorem ipsum dolor sit amet, consectetur adipisicing elit.");                     
$values["b"] = Array("label" => "something else",
                     "description" => "Lorem ipsum dolor sit amet, consectetur.");
$form->addField(FieldFactory::RadioButtonField()->name("category")->label("Category")->required(true)->values($values));

$form->addField(FieldFactory::CheckboxField()->name("whodunit")->label("Whodunit")->required(true)->values(Array("asd" => "Jope Asd", "wfa" => "Jane Wfa")));


if(isset($_POST['name'])) {
  $form->populate($_POST);
  if($form->validate()){
    //$form->process();
  }
}

print $form->render();

?>
</div>

</body>
</html>
